var e = require;
var t = module;
var o = exports;
var ii, nn = this && this.__extends || (ii = function (t, e) {
    return (ii = Object.setPrototypeOf || {
        __proto__: []
    }
        instanceof Array &&
        function (t, e) {
            t.__proto__ = e
        } ||
        function (t, e) {
            for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
        })(t, e)
},
    function (t, e) {
        function o() {
            this.constructor = t
        }
        ii(t, e),
            t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
    }
),
    rr = this && this.__awaiter ||
        function (t, e, o, i) {
            return new (o || (o = Promise))(function (n, a) {
                function r(t) {
                    try {
                        l(i.next(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function s(t) {
                    try {
                        l(i.
                            throw(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function l(t) {
                    var e;
                    t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
                        t(e)
                    })).then(r, s)
                }
                l((i = i.apply(t, e || [])).next())
            })
        };
var oo = (this && this.__decorate) ||
    function (e, t, a, n) {
        var i,
            o = arguments.length,
            s = o < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, a)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);
        else
            for (var r = e.length - 1; r >= 0; r--)
                (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
        return o > 3 && s && Object.defineProperty(t, a, s), s;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = e("BaseModuleUI"),
    n = e("NotifyEventType"),
    i = e("GlobalParams"),
    r = e("AssetsManager"),
    s = e("AudioManager"),
    l = e("Game"),
    _ = e("monster_node_info"),
    c = cc._decorator,
    d = c.ccclass,
    h = c.property,
    u = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.role_soldier_view = null),
                (t.monster_pos = [
                    new cc.Vec2(-1120, 540),
                    new cc.Vec2(-1120, -770),
                    new cc.Vec2(1120, 540),
                    new cc.Vec2(1120, -770),
                    new cc.Vec2(10, -1150),
                    new cc.Vec2(10, 850),
                    new cc.Vec2(-10, 850)
                ]),
                t
            );
        }
        return (
            nn(t, e),
            (t.prototype.addEvent = function () {
                this.attachEvent(n.default.SEND_CREATE_MONSTER_INDEX, this.createMonster, this);
            }),
            (t.prototype.createMonster = function (e, t) {
                this.createOneMonster(t);
            }),
            (t.prototype.createOneMonster = function (e) {
                var t = i.GlobalParams.MonsterDisNum[e],
                    o = null;
                t.type == l.MonsterType.red
                    ? (o = cc.instantiate(r.default.getInstance().getFightPrefab("monster_red")))
                    : t.type == l.MonsterType.bule
                        ? (o = cc.instantiate(r.default.getInstance().getFightPrefab("monster_bule")))
                        : t.type == l.MonsterType.spider
                            ? (o = cc.instantiate(r.default.getInstance().getFightPrefab("monster_spider")))
                            : t.type == l.MonsterType.dragon
                                ? (o = cc.instantiate(r.default.getInstance().getFightPrefab("monster_dragon")))
                                : t.type == l.MonsterType.big_dragon &&
                                (this.role_soldier_view.getChildByName("monster_spider") &&
                                    (this.role_soldier_view.getChildByName("monster_spider").destroy(),
                                        (i.GlobalParams.MonsterDisNum[5].time = -1)),
                                    (o = cc.instantiate(r.default.getInstance().getFightPrefab("monster_big_dragon"))),
                                    this.emitEvent(n.default.SEND_PLAYER_SHOOT_WOINDE_ANIME),
                                    s.default.getInstance().playFx("dragon_idle")),
                    o.getComponent(_.default).showMonsterDisInfo(e),
                    o.setPosition(this.monster_pos[e]),
                    o.setParent(this.role_soldier_view);
            }),
            oo([h(cc.Node)], t.prototype, "role_soldier_view", void 0),
            oo([d], t)
        );
    })(a.default);
o.default = u;
